import pandas as pd
import os

# 设置显示选项，使其更易读
pd.set_option('display.max_columns', None)
pd.set_option('display.width', 1000)

# 定义要查看的文件
files = [
    'word.csv',
    'word_translation.csv',
    'book.csv',
    'relation_book_word.csv'
]

# 当前目录
current_dir = os.path.dirname(os.path.abspath(__file__))

# 逐个查看文件
for file_name in files:
    file_path = os.path.join(current_dir, file_name)
    print(f"\n{'='*50}\n文件: {file_name}\n{'='*50}")
    
    try:
        # 根据README中的说明，大部分文件使用'>'作为分隔符
        if file_name != 'word_translation.csv':
            df = pd.read_csv(file_path, sep='>', nrows=5)
        else:
            df = pd.read_csv(file_path, nrows=5)
        
        print(f"形状: {df.shape}")
        print("前5行数据:")
        print(df.head())
        print(f"\n列信息:")
        for col in df.columns:
            print(f"- {col}")
            
    except Exception as e:
        print(f"读取文件失败: {e}")